package net.javastone.toolkit.core.model;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Set;

/**
 * Created by sdliang on 2019/10/10.
 */
@Getter
@Setter
public class CompareResult {

  /**
   * 源文件特有的属性
   */
  private Set<String> fromProps;

  /**
   * 目标文件特有的属性
   */
  private Set<String> toProps;

  /**
   * 值不一样的属性
   */
  private Set<ValueDiff> valueDiffs;

  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class ValueDiff {

    private static final String FORMAT = "属性[%s]: 源[%s] -> 目标[%s]";

    /**
     * 属性名
     */
    private String prop;
    /**
     * 源值
     */
    private String from;
    /**
     * 目标值
     */
    private String to;

    @Override
    public String toString() {
      return String.format(FORMAT, prop, from, to);
    }
  }
}
